<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>万信管理后台</title>
    <%@ include file="/commons/meta.jsp"%>
    <link href="${ctx}/resources/admin/css/base.css" rel="stylesheet">
    <link href="${ctx}/resources/admin/css/zTreeStyle.css" rel="stylesheet">
</head>
<body>
<!-- <div id="loading" class="loading" >加载中…</div>-->
<div id="shade-div" class="shade-div hide"></div> 
<%@ include file="/jsps/admin/inc/header.jsp"%>
<%@ include file="/jsps/admin/inc/menu.jsp"%>

<div id="main">
    <div id="content">
    <div class="hd">
        <span>客户端管理</span>
    </div>
    <div class="tab-box">
        <ul>
            <li <s:if test="clientType==3">class="cur"</s:if>><a href="../upgrade/client_version!list.xhtml?clientType=3">windows客户端</a></li>
            <li <s:if test="clientType==1">class="cur"</s:if>><a href="${ctx}/upgrade/client_version!list.xhtml?clientType=1">andriod客户端</a></li>
            <li <s:if test="clientType==2">class="cur"</s:if>><a href="${ctx}/upgrade/client_version!list.xhtml?clientType=2">iOS客户端</a></li>
            <li <s:if test="clientType==4">class="cur"</s:if>><a href="${ctx}/upgrade/client_version!list.xhtml?clientType=4">Mac端</a></li>
              <li <s:if test="clientType==5">class="cur"</s:if>><a href="${ctx}/upgrade/client_version!versionList.xhtml?clientType=5">客户端历史版本</a></li>
        </ul>
    </div>
    <div class="hd">
            <form action="../upgrade/client_version!versionList.xhtml?clientType=5" method="post" class="" name="form1">
           &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;
           <select class="fl"  name="utype"  >
                <option value="">全部版本</option>
                <option value="1" <s:if test="utype==1">selected</s:if>>Android</option>
                <option value="2" <s:if test="utype==2">selected</s:if>>IOS</option>
                <option value="3" <s:if test="utype==3">selected</s:if>>PC</option>
                <option value="4" <s:if test="utype==4">selected</s:if>>MAC</option>
            </select>
                <button class="btn blue-btn" type="submit">查询</button>
          </form>
    </div>
  
     <table class="table-list">
       <tr>
           <th>类型</th>
           <th>版本号</th>
           <th>链接地址</th>
           <th>创建时间</th>
           <th>操作</th>
       </tr>
       
    <s:iterator value="pager.result" status="i" var="ss">
       <tr>
           <td>
            <s:if test="clientType==1">Android</s:if>
            <s:elseif test="clientType==2">IOS</s:elseif>
            <s:elseif test="clientType==3">PC</s:elseif>
            <s:elseif test="clientType==4">MAC</s:elseif>
            <s:elseif test="clientType==5">windowsPhone</s:elseif>
           </td>
           <td><s:property value="fullVerNum" /></td>
           <td><s:property value="fullUrl" /></td>
            
           <td><s:date name="updateTime" format="yyyy-MM-dd HH:mm:ss" /></td>
           <td>
           <a href="javascript:qy(<s:property value="id" />,<s:property value="enableFlag" />);"  id="ss<s:property value="id" />" class="disable"><s:if test="enableFlag==0">已禁用</s:if><s:elseif test="enableFlag==1">已启动</s:elseif></a>
            &nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:;" class="del"  title="${id}">删除</a> </td>
       </tr>
    </s:iterator>
   </table>
        <s:if test="pager.totalCount > 0">
			<jsp:include page="/jsps/admin/inc/pager.jsp">
				<jsp:param name="pageUrl" value="${ctx}/log/system_log!list.xhtml" />
			</jsp:include>
		</s:if>
		<s:else>
			<div class="pages" align="center">没有找到任何记录!</div>
		</s:else>
</div>


</div>
</div>
<%@ include file="/jsps/admin/inc/footer.jsp"%>
<!--添加-->
<div class="popbox w560" id="addVersion" >
    <div class="popbox-hd">
        <h2>添加用户</h2>
        <a href="javascript:;" title="关闭" class="closePopBtn"></a>
    </div>
    <div class="popbox-bd clearfix">
        <div class="clearfix" style="position: relative;padding: 10px 0">
            <div class="left_info">
                <p class="center">组织框架</p>
                <div class="zTreeDemoBackground" style="border: 1px solid #ccc;height: 400px;overflow: auto;">
                    <form action="" method="" style="text-align: center">
                        <div id="searchName" style="width: 196px;border-radius: 0">
                            <button type="submit" class="searchName"></button>
                            <input type="text" value="输入姓名、账号、拼音等进行搜索" class="gray" style="width: 118px;">
                            <span class="removeSearch"></span>
                        </div>
                    </form>
                    <ul id="treeDemo" class="ztree">
                    </ul>
                </div>
            </div>
            <div class="removeBtn">
                <button class="btn gray-btn">新增<i class="na"></i></button>
                <button class="btn gray-btn"><i class="re"></i>移除</button>
            </div>
            <div class="right_info">
                <p class="center">已选择部门或成员</p>
                <div class="zTreeDemoBackground" style="border: 1px solid #ccc;height: 400px;overflow: auto;">
                    <ul id="treeDemo1" class="ztree">
                    </ul>
                </div>

            </div>
        </div>
    </div>
    <div class="popbox-ft">
        <a href="javascript:;" class="btn blue-btn">确定</a><a href="javascript:;" class="btn gray-btn cancelBtn">取消</a>
    </div>
</div>
<!--警告框-->
<div class="popbox w300" id="warning" >
    <div class="popbox-hd">
        <h2>警告</h2>
        <a href="javascript:;" title="关闭" class="closePopBtn"></a>
    </div>
    <div class="popbox-bd">
        <p class="center"></p>
         <input type="hidden"  id="deId"/>
    </div>
    <div class="popbox-ft">
        <a href="javascript:;" class="btn blue-btn" id="btnDelete3">确定</a><a href="javascript:;" class="btn gray-btn cancelBtn">取消</a>
    </div>
</div>

<div class="popbox w300" id="warning3" >
    <div class="popbox-hd">
        <h2>警告</h2>
        <a href="javascript:;" title="关闭" class="closePopBtn"></a>
    </div>
    <div class="popbox-bd">
        <p class="center"></p>
    </div>
    <div class="popbox-ft">
        <a href="javascript:qyok();" class="btn blue-btn"  id="btnqy">确定</a><a href="javascript:;" class="btn gray-btn cancelBtn">取消</a>
    </div>
</div>

<script src="${ctx}/resources/admin/js/lib/jquery-1.8.0.min.js"></script>
<script src="${ctx}/resources/admin/js/common.js"></script>
<script src="${ctx}/resources/admin/js/lib/jquery-ui.js"></script>
<script type="text/javascript" src="${ctx}/resources/artDialog/jquery.artDialog.js?skin=blue"></script>

<script type="text/javascript">
$(function(){
	common.menuClicked('P26', 'C27');
	 var self=this;
     self.shadeDiv = $("#shade-div");
	  $(".del").click(function(){
	       
	    	var  warnlevel= $(this).attr("title");
	    	$("#deId").val(warnlevel);
	        self.shadeDiv.show();
	        $('#warning').setPosition().show().find("p.center").html("确定要删除吗？");

	    })
	    
	    
	         //删除按钮 3 
      $("#btnDelete3").click(function(){
          
    	var deId=  $("#deId").val();
    	$.ajax({
    		type : "POST",
    		url : "../upgrade/client_version!delete.xhtml",
    		data : {id:deId},
    		success : function(data) {
    			 self.shadeDiv.hide();
    			if(data=='true'){
    			//alert("删除成功！");
    			 artDialog({icon: 'succeed',title: '提示',lock: true,opacity: 0.2,zIndex:8888,content:"删除成功！",button:[{name: '确定'}]});
    			 common.refreshPage();
    			$('.del').setPosition().hide();
    			}else{
    				//alert(data);
    				 artDialog({icon: 'warning',title: '提示',lock: true,opacity: 0.2,zIndex:8888,content:data,button:[{name: '确定'}]});
    			}
    		}
    	});
    

     })
});


var zid="";
var ztype="";
function qy(id,type){
	zid=id;
	ztype=type;
	if(type==1){
	 $('#warning3').setPosition().show().find("p.center").html("确定要禁用？");
	}else if(type==0){
	  $('#warning3').setPosition().show().find("p.center").html("确定要启用？");
	}

	
}

function qyok(){
	
	 $('#warning3').setPosition().hide();
	$.ajax({
		type : "POST",
		url : "../upgrade/client_version!updateState.xhtml",
		data : "id="+zid+"&enableFlag="+ztype,
		beforeSend : function() {
		},
		success : function(data) {
			
		    // $('#warning').setPosition().show().find("p.center").html(data);
			if(ztype==1){
				//alert("启用成功");
				artDialog({icon: 'succeed',title: '提示',lock: true,opacity: 0.2,zIndex:8888,content:"启用成功",button:[{name: '确定'}]});
				$("#ss"+zid).html("已禁用");
				$("#ss"+zid).attr("href","javascript:qy("+zid+",0)");
				
			}else if(ztype==0){
				//alert("禁用成功");
				artDialog({icon: 'succeed',title: '提示',lock: true,opacity: 0.2,zIndex:8888,content:"禁用成功",button:[{name: '确定'}]});
				$("#ss"+zid).html("已启动");
				$("#ss"+zid).attr("href","javascript:qy("+zid+",1)");
			}
		}
	});
	
	
}

</script>
</body>
</html>